# -*- coding: utf-8 -*-

# Copyright (C) 2011 Dimitri Linten

#This file is part of Quiz.
#
#ThunderStrom is free software: you can redistribute it and/or modify
#it under the terms of the GNU Lesser General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#pyQuiz is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU Lesser General Public License for more details.
#
#You should have received a copy of the GNU Lesser General Public License
#along with pyQuiz.  If not, see <http://www.gnu.org/licenses/>.

from matplotlib.pyplot import figure
from simple_plots import *
import matplotlib
matplotlib.interactive(True)

import numpy as np

class View(object):
    '''
    Could work on Tabel or Room
    '''
    def __init__(self, room):
        self.room = room

    def __repr__(self):
        message = "View of "
        message += str(self.room)
        return message

    def CurrentScores(self):
        fig = figure()
        self.fig = CurrentScores(fig,
                                     self.room.CalculateCurrentScores())
        
    def CurrentScoresTopic(self,n):
        fig = figure()
        self.fig = CurrentScoresTopic(fig,
                                     self.room.CalculateCurrentScoresTopic(n),self.room.sessionNames[n])
        
    def ScoresSchifting(self):
        fig = figure()
        self.fig = ScoresSchift(fig,
                                     self.room.CalculateSchifting())
    
    def CurrentScoresAll(self):
        
#        fig = figure()
#        self.fig = CurrentScores(fig,
#                                     self.room.CalculateCurrentScores())
#        
#        fig = figure()
#        self.fig = ScoresSchift(fig,
#                                     self.room.CalculateSchifting())
        
        for i in np.arange(10,dtype=int)+1:
            fig = figure(i)
            self.fig = CurrentScoresTopic(fig,
                                         self.room.CalculateCurrentScoresTopic(i),self.room.sessionNames[i])
#            
#        self.fig = CurrentScoresTopic(fig,
#                                         self.room.CalculateCurrentScoresTopic(13),'Tussen ronden')